Developer's Manual for ASPPW FDMgt Component
Version | : | 1.1 |
Status | : | Draft |
Public Property Get Files() As Collection Public Property Get SubDirs() as Collection 'Error handling Public Property Get GetLastErrNum() As Long Public Property Get GetLastErrSource() As String Public Property Get GetLastErrDescription() As String Methods:
Public Function CopyFile(ByVal sSrcFilePathName As String, ByVal sDesFilePathName As String) As Integer Public Function CopyFileEx(ByVal sSrcDir As String, ByVal sDesDir As String, ByVal sCopyPtn) As Integer Public Function DeleteFile(ByVal sFilePathName As String) As Integer Public Function IsFileExists(ByVal sFilePathName As String) As Integer Public Function ReadFile(ByVal sFilePathName As String) As String Public Function WriteFile(ByVal sFilePathName As String, ByVal sFileBuff As String) As Long Public Function ReadFileLength(ByVal sFilePathName As String) As Long Public Function GetFileInfo(ByVal sFilePathName as String) as CFile Public Function MakeDir(ByVal sDirPathName As String) As Integer Public Function DeleteDir(ByVal sDirPathName As String) As Integer Public Function RenameDir(ByVal sOldPathName As String, ByVal sNewPathName As String) As Integer Public Function ReadDir(ByVal sDirPathName As String) As Integer Public Function IsDirExists(ByVal sDirPathName As String) As Integer Public Function GetFDAttr(ByVal sPathName As String) As Integer Public Function SetFDAttr(ByVal sPathName As String, ByVal nAttr As Integer) As Integer Public Function GetWindowsDirectory() As String Public Function GetSystemDirectory() As String Public Function GetDiskFreeSpace(ByVal sRootPathName As String) As Currency
Usage: 1. Create object:
Set oFDMgt = Server.CreateObject("ASPPW.FDMgt") 2. Descriptions: Public Function CopyFile(ByVal sSrcFilePathName As String, ByVal sDesFilePathName As String) As Integer
Remarks:
Copies a file. Input:
sSrcFilePathName:
String expression that specifies the name of the file to be copied. The source may include directory or folder, and drive.
sDesFilePathName:
String expression that specifies the target file name. The destination may include directory or folder, and drive.\
Output:
1 : Succeeded. 0 : sSrcFilePathName not found. -1 : Failed. Public Function CopyFileEx(ByVal sSrcDir As String, ByVal sDesDir As String, ByVal sCopyPtn) As Integer
Remarks:
Copies multiple files from a directory to another. Input: sSrcDir:
String expression that specifies the name of the directory be copied. The source may include drive. sDesDir:
String expression that specifies the target directory. The destination may include drive. sCopyPtn:
Supports the use of multiple-character (*) and single-character (?) wildcards to specify multiple files. Output: 1 : Succeeded. 0 : sSrcDir or sDesDir not found or other errors. -1 : Failed.
Note: Versions prior to 1.1.5 returns number of files copied. Public Function DeleteFile(ByVal sFilePathName As String) As Integer Remarks:
Deletes a file.
Input: sFilePathName:
String expression that specifies the name of the to be deleted. Output: 1 : Succeeded. 0 : sFilePathName not found. -1 : Failed. Public Function IsFileExists(ByVal sFilePathName As String) As Integer Remarks:
Checks whether a file exists or not.
Input: sFilePathName:
String expression that specifies the name of the to be checked. Output: 1 : Exists. 0 : sFilePathName not found. -1 : Failed. Not Exists. Public Function ReadFile(ByVal sFilePathName As String) As String Remarks:
Reads the content of a file.
Input: sFilePathName:
String expression that specifies the name the file to be read. Output:
String : File Contents "" : sFilePathName not found or Failed.
Public Function WriteFile(ByVal sFilePathName As String, ByVal sFileBuff As String) As Long Remarks:
Writes the content of a file to disk.
Input:
sFilePathName:
String expression that specifies the name of the file to be written.
sFileBuff:
String expression that specifies the content to be written. Output:
>=0 : Bytes written to the file. -1 : Failed. Public Function ReadFileLength(ByVal sFilePathName As String) As Long Remarks:
Returns a Long specifying the length of a file in bytes.
Input: sFilePathName:
The required sFilePathName argument is a string expression that specifies a file. The pathname may include the directory or folder, and the drive. Output:
>=0 : A Long specifying the length of a file in bytes. -1 : Failed. Not Exists. Public Function GetFileInfo(ByVal sFilePathName As String) As CFile Remarks:
Returns a class object specifying file or directory information.
Input: sFilePathName:
The required sFilePathName argument is a string expression that specifies a file or directory name. The pathname may include the directory or folder, and the drive. Output:
CFile Object: CFile object's properties: Name (String) Length (Long) Attr (Integer) CreationTime (String) LastWriteTime(String) LastAccessTime(String)
Nothing : Failed. File/directory not found.
Public Function MakeDir(ByVal sDirPathName As String) As Integer Remarks:
Creates a new directory or folder.
Input:
sDirPathName:
The required path argument is a string expression that identifies the directory or folder to be created. The path may include the drive. If no drive is specified, MakeDir creates the new directory or folder on the current drive.
Output: 1 : Succeed. -1 : Failed. Public Function DeleteDir(ByVal sDirPathName As String) As Integer Remarks:
Deletes a directory or folder and all files and subdirectories under it.
Input: sDirPathName:
The required path argument is a string expression that identifies the directory or folder to be deleted. The path may include the drive. If no drive is specified, MakeDir creates the new directory or folder on the current drive.
Output: 1 : Succeed. 0 : sDirPathName not found. -1 : Failed.
Public Function RenameDir(ByVal sOldPathName As String, ByVal sNewPathName As String) As Integer Remarks:
Renames a directory, or folder on a same drive.
Input: sOldPathName:
String expression that specifies the existing directory name and location— may include drive.
sNewPathName:
String expression that specifies the new name and location— may include drive. The directory name specified by sNewPathName can't already exist. Output:
1 : Succeed. 0 : sOldPathName not found. -1 : Failed. Public Function ReadDir(ByVal sDirPathName As String) As Integer Remarks:
Returns a file list and a sub directory list under the specified directory. Input:
sDirPathName:
String expression that specifies the directory name and location— may include drive. Output:
1 : Succeed. Collection oFDMgt.Files contains a file list. Collection oFDMgt.SubDirs contains a subdirectory list. Each item, a file object in oFDMgt.Files contains following properties: Public Property Get Name() As String Public Property Get Attr() As Integer Public Property Get Length() As Long Public Property Get DateTime() As String 'Same as LastWriteTime Public Property Get CreationTime() As String Public Property Get LastWriteTime() As String Public Property Get LastAccessTime() As String Each item, a subdir object in oFDMgt.SubDirs contains following properties: Public Property Get Name() As String Public Property Get Attr() As Integer Public Property Get DateTime() As String 'Same as CreationTime 0 : sDirPathName not found. -1 : Failed. Public Function IsDirExists(ByVal sDirPathName As String) As Integer Remarks:
Checks whether a directory or folder exists or not.
Input: sDirPathName:
String expression that specifies the name of the to be checked.
Output: 1 : Exists. 0 : sDirPathName not found. -1 : Failed. Not Exists. Public Function GetFDAttr(ByVal sPathName As String) As Integer Remarks:
Returns an Integer representing the attributes of a file, directory, or folder.
Input: The required pathname argument is a string expression that specifies a file name. The pathname may include the directory or folder, and the drive. Output: >=0 : Constant Value Description vbNormal 0 Normal vbReadOnly 1 Read-only vbHidden 2 Hidden vbSystem 4 System vbDirectory 16 Directory or folder vbArchive 32 File has changed since last backup -1 : Error. Public Function SetFDAttr(ByVal sPathName As String, ByVal nAttr As Integer) As Integer Remarks:
Sets attribute information for a file or directory.
Input: sPathName: String expression that specifies a file name—may include directory or folder, and drive.
nAttr: Constant Value Description vbNormal 0 Normal (default) vbReadOnly 1 Read-only vbHidden 2 Hidden vbSystem 4 System file vbArchive 32 File has changed since last backup Output: 1 : Succeeded. -1 : Failed. Public Function GetWindowsDirectory() As String Remarks:
Returns Windows directory.
Input:
None.
Output:
String contains Windows directory. Public Function GetSystemDirectory() As String Remarks:
Returns Windows system directory.
Input:
None.
Output:
String contains Windows system directory.
Public Function GetDiskFreeSpace(ByVal sRootPathName As String) As Currency
Remarks:
Returns disk free space.
Input:
Root path of the disk driver, like "c:\"
Output:
>=0 : Free disk space in bytes. -1 : Failed.
Samples: Please refer to ASP demonstration files.